import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';

const root = ReactDOM.createRoot(
  document.getElementById('root') as HTMLElement
);
root.render(
  <React.StrictMode>
    <App />
  </React.StrictMode>
);

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals();


class Person3{
     name: string ;
     constructor(name:string ) {
              this.name=name;
     }
}
class Children1 extends Person3{
                       age:number;
                       sex:string;
                       constructor(name:string,age:number,sex:string){
                            super(name);
                            this.age=age;
                            this.sex=sex;
                       }
                      eat(){
                           console.log('中午吃什么')
                      }
}
let p8=new  Children1("韩犇",20,'男')
console.log(p8)
p8.eat();


let arr7:number[]=[10,4,5,1];
//数组的最大差值 排序
arr7.sort(function(a,b){return b-a});
console.log(arr7)

console.log(arr7[0]-arr7[arr7.length-1])


function fn7(arry:number[]) {
        let temp: number[] = [];
        //去重
        arry.forEach((item,index) => {
                  if (temp.indexOf(item) == -1){
                          temp.push(item)
                  }
        })
        // 求和
        let sum = temp.reduce((prev: number,next: number) => prev + next,0);
        return sum;
}

console.log(fn7([1,3,6,7,9,12]))
